export const namespace = "contentExamRecords";
import { Button } from "antd";
import { history } from "umi";

export const calcColumns = (params) => {
  const columns = [
    {
      title: "会员昵称",
      dataIndex: "memberNickName",
    },
    {
      title: "手机号码",
      dataIndex: "memberTel",
    },
    {
      title: "测试时间",
      dataIndex: "createTime",
      hideInSearch: true,
    },
    {
      title: "试卷名称",
      dataIndex: "examName",
      hideInSearch: true,
    },
    {
      title: "试卷分值",
      dataIndex: "examScore",
      hideInSearch: true,
    },
    {
      title: "测验得分",
      dataIndex: "memberExamGrade",
      hideInSearch: true,
    },
    {
      title: "操作",
      fixed: "right",
      dataIndex: "option",
      hideInSearch: true,
      render: (_, record) => (
        <Button
          type="link"
          onClick={() => {
            history.push(`/content/exam/detail?id=${record.id}`);
          }}
        >
          查看
        </Button>
      ),
    },
  ];
  if (params?.operate) {
    columns.push(params?.operate);
  }
  return columns;
};
